home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 October / CHIP Ekim 1996.iso / winbatch / progman.wi_ < prev    next >
Text File  |  1995-10-29  |  4KB  |  145 lines

  1. ;;Program manager WBT script.  Adding/Deleting/Showing Program Manager Groups and Icons.  
  2. ;; This script shows how to use DDE to communicate with Windows 3.1
  3. ;; and Windows NT (pre-Explorer).
  4. ;; With Windows 95 you can just put shortcuts into the Start Menu.
  5.                     ;;Written February 1994  by Wilson WindowWare, Inc.  
  6.  
  7. ;;Call Progman.wil
  8. ;;Syntax of commands:
  9. ;;    Call("progman.wil", "AddGroup 'Group Title'")
  10. ;;        (             , "DelGroup 'Group Title'")
  11. ;;        (             , "AddIcon 'Group Title' 'File and Path' 'Icon Description'")
  12. ;;        (             , "DelIcon 'Group Title' 'Icon Description'")
  13. ;;        (             , "ShowGroup 'Group Title' ShowCommand")
  14. ;;        (             , "ReplaceItem 'Group Title' 'Icon Description'")
  15. ;;        (             , "Reload 'Group Title'")
  16.  
  17.  
  18. ;;Show command is an integer which specifies the action Program Manager is to perform on the group window.
  19. ;;        VALUE          ACTION
  20. ;;          1               Restores group to its original size and position.
  21. ;;          2               Displays group as an icon.
  22. ;;          3               Displays group as a maximized window.
  23. ;;          6               Minimizes the group window.
  24. ;;                                 
  25.  
  26. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. ;Check to see if Program manager is running.  If not, run it.
  30. AX=DDEInitiate("Progman", "Progman")
  31. IF AX==0    ; Hmmm nobody's home
  32.     run("progman.exe","")
  33.     delay(2)
  34.     AX=DDEInitiate("Progman", "Progman")
  35.     If AX==0     ;   ooooo its really dead.  Give up
  36.          Message("Program Manager DDE Initiate", "Didn't work.  Giving up.  Going home")
  37.          return 
  38.     endif
  39. endif
  40.  
  41.  
  42. ErrorMode(@OFF)
  43. If AppExist("Progman.exe")  then WinActivate("Program Manager")
  44. ErrorMode(@ON)
  45. ErrorMSG=""
  46. ; Fake a case statement with a string for a variable
  47. Goto %Param1%
  48.            
  49.  
  50.  
  51. :ADDGROUP
  52. ;Add a group to program manager.                                                              
  53.      
  54. Err=DDEExecute(AX,"[CreateGroup(%param2%)]")
  55. If Err==0 then ErrorMSG="[CreateGroup(%param2%)] Failed"
  56. goto byebye
  57.  
  58.  
  59.  
  60.  
  61. :DELGROUP
  62. ;Delete a group from the program manager.
  63.      
  64. Err=DDEExecute(AX,"[DeleteGroup(%param2%)]")
  65. If Err==0 then ErrorMSG="[DeleteGroup(%param2%)] Failed"
  66. goto byebye
  67.  
  68.  
  69.  
  70. :ADDICON
  71. ;Add an icon to a program group.
  72.  
  73. ;show or create the group first.
  74. DDEExecute(AX,"[CreateGroup(%param2%)]")
  75. ;Add the item.     
  76. Err=DDEExecute(AX,"[AddItem(%param3%,%param4%,,,-1,-1,,,0)]")
  77. If Err==0 then ErrorMSG="[AddItem(%param3%,%param4%,,,-1,-1,,,0)] Failed"
  78. goto byebye
  79.  
  80.  
  81.  
  82.  
  83.  
  84. :DELICON
  85. ;Delete an icon from the program manager.
  86.  
  87. ;show or create the group
  88. DDEExecute(AX,"[ShowGroup(%param2%,1)]")
  89. ;Delete the icon.     
  90. Err=DDEExecute(AX,"[DeleteItem(%param3%)]")
  91. If Err==0 then ErrorMSG="[DeleteGroup(%param3%)] Failed"
  92. goto byebye
  93.  
  94.  
  95.  
  96.  
  97. :SHOWGROUP
  98. ;Show a program group. 
  99.      
  100. ;show or create the group
  101. Err=DDEExecute(AX,"[ShowGroup(%param2%,%param3%,)]")
  102. If Err==0 then ErrorMSG="[ShowGroup(%param2%,%param3%,)] Failed"
  103. goto byebye
  104.  
  105.  
  106.  
  107.  
  108. :RELOAD
  109. ;This command instructs Program Manager to remove and reload an existing group.
  110.  
  111. ;Show the group.
  112. DDEExecute(AX,"[ShowGroup(%param2%,1)]")
  113. delay(2)
  114. Err=DDEExecute(AX,"[Reload(%param2%)]")
  115. If Err==0 then ErrorMSG="[Reload(%param2%)] Failed"
  116. goto byebye
  117.  
  118.  
  119.  
  120.  
  121. :REPLACEITEM
  122. ;This command deletes an item and records the position.  A new item can be added to this 
  123. ;position using AddIcon.
  124.  
  125. ;Show the group.
  126. DDEExecute(AX,"[ShowGroup(%param2%,1)]")
  127. delay(2)
  128.  
  129. ;record the position and delete existing group.
  130. Err=DDEExecute(AX,"[ReplaceItem(%param3%)]")
  131. If Err==0 then ErrorMSG="[ReplaceItem(%param3%)] Failed"
  132. goto byebye
  133.  
  134.  
  135.       
  136.  
  137.  
  138. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  139. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  140. :byebye
  141. DDETerminate(AX)
  142. If ErrorMSG!="" then message("Progman DDE Failed", ErrorMSG)
  143. RETURN
  144.  
  145.